import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  // {
  //   title: '用户ID',
  //   align: "center",
  //   dataIndex: 'memberId'
  // },
  {
    title: '变动积分',
    align: "center",
    dataIndex: 'point'
  },
  {
    title: '来源类型',
    align: "center",
    dataIndex: 'type',
    customRender: ({ text }) => {
      text = text == 0 ? '消费积分' : text == 1 ? '补贴积分' : text == 2 ? '卖家积分' : text == 3 ? '分享收入' : text == 4 ? '自动配股' : text == 5 ? '消费积分补贴' : text == 6 ? '工资' : text == 7 ? '月供' : '募捐';
      return text;
    },
  },
  {
    title: '积分来源说明',
    align: "center",
    dataIndex: 'remark',
    width: '500px'

  },
  {
    title: '用户名称',
    align: "center",
    dataIndex: 'memberName'
  },
  {
    title: '手机号',
    align: "center",
    dataIndex: 'phone'
  },
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createTime'
  },

];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "用户ID",
    field: 'memberId',
    component: 'JSearchSelect',
    componentProps: {
      dict: "sys_user where user_type = 1,realname,id"
    },
    //colProps: {span: 6},
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '用户ID',
    field: 'memberId',
    component: 'JSearchSelect',
    componentProps: {
      dict: "sys_user where user_type = 1,realname,id"
    },
  },
  {
    label: '变动积分',
    field: 'point',
    component: 'InputNumber',
  },
  {
    label: '来源类型 ',
    field: 'type_dictText',
    component: 'Input',

  },
  {
    label: '积分来源说明',
    field: 'remark',
    component: 'Input',
  },
  {
    label: '用户名称',
    field: 'memberName',
    component: 'Input',
  },
  {
    label: ' 0 未配股  1已配股',
    field: 'status',
    component: 'InputNumber',
  },
  {
    label: '手机号',
    field: 'phone',
    component: 'Input',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

// 高级查询数据
export const superQuerySchema = {
  memberId: { title: '用户ID', order: 0, view: 'sel_search', type: 'string', dictTable: "sys_user where user_type = 1", dictCode: 'id', dictText: 'realname', },
  point: { title: '变动积分', order: 1, view: 'number', type: 'number', },
  type: { title: '来源类型 0消费积分 1补贴积分 2卖家补贴 3分享收入', order: 2, view: 'text', type: 'string', },
  remark: { title: '积分来源说明', order: 3, view: 'text', type: 'string', },
  memberName: { title: '用户名称', order: 4, view: 'text', type: 'string', },
  status: { title: ' 0 未配股  1已配股', order: 5, view: 'number', type: 'number', },
  phone: { title: '手机号', order: 6, view: 'text', type: 'string', },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}